package com.bh.shipment.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.shipment.domain.JcShipmentBack;
import com.bh.shipment.mapper.JcShipmentBackMapper;
import com.bh.shipment.service.IJcShipmentBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 运单回单Service业务层处理
 *
 * @author slx
 * @date 2023-04-22
 */
@Service
public class JcShipmentBackServiceImpl extends ServiceImpl<JcShipmentBackMapper, JcShipmentBack> implements IJcShipmentBackService {
    @Autowired
    private JcShipmentBackMapper jcShipmentBackMapper;

    /**
     * 查询运单回单
     *
     * @param id 运单回单主键
     * @return 运单回单
     */
    @Override
    public JcShipmentBack selectJcShipmentBackById(Long id) {
        return jcShipmentBackMapper.selectById(id);
    }

    /**
     * 查询运单回单列表
     *
     * @param jcShipmentBack 运单回单
     * @return 运单回单
     */
    @Override
    public List<JcShipmentBack> selectJcShipmentBackList(JcShipmentBack jcShipmentBack) {
        return jcShipmentBackMapper.selectJcShipmentBackList(jcShipmentBack);
    }

    /**
     * 新增运单回单
     *
     * @param jcShipmentBack 运单回单
     * @return 结果
     */
    @Override
    public int insertJcShipmentBack(JcShipmentBack jcShipmentBack) {
        jcShipmentBack.setCreateTime(DateUtils.getNowDate());
        return jcShipmentBackMapper.insert(jcShipmentBack);
    }

    /**
     * 修改运单回单
     *
     * @param jcShipmentBack 运单回单
     * @return 结果
     */
    @Override
    public int updateJcShipmentBack(JcShipmentBack jcShipmentBack) {
        return jcShipmentBackMapper.updateById(jcShipmentBack);
    }

    /**
     * 批量删除运单回单
     *
     * @param ids 需要删除的运单回单主键
     * @return 结果
     */
    @Override
    public int deleteJcShipmentBackByIds(Long[] ids) {
        return jcShipmentBackMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除运单回单信息
     *
     * @param id 运单回单主键
     * @return 结果
     */
    @Override
    public int deleteJcShipmentBackById(Long id) {
        return jcShipmentBackMapper.deleteById(id);
    }
}
